﻿function ClientAddLawDocumentType()
{
    Url=Portal.CMS.LawDocumentType.GetAddGroupNewUrl().value;
    window.open(Url, '_blank');
}

function ClientSaveAddLawDocumentType()
{
    Subject=document.getElementById("txtSubject").value;
    RetValue = Portal.CMS.AddLawDocumentType.ServerSideAddLawDocumentType(Subject).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    document.getElementById("txtSubject").value="";
    document.getElementById("txtSubject").focus();
}

function ClientDeleteLawDocumentType(LawDocumentTypeId)
{
    Msg=Portal.CMS.LawDocumentType.ServerSideCheckDeleteLawDocumentType().value;
    if(Msg.indexOf("ERROR")!=-1)
    {
        alert(Msg);
        return;
    }
    
    Msg=Portal.CMS.LawDocumentType.GetConfirmDeleteMsg().value;
    if(confirm(Msg)==false)return;
    RetValue = Portal.CMS.LawDocumentType.ServerSideDeleteLawDocumentType(LawDocumentTypeId).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    RealJumpPageLawDocumentType();
}

function ShowClientUpdateUrlForm(LawDocumentTypeId)
{
    Url=Portal.CMS.LawDocumentType.GetShowUpdateForm(LawDocumentTypeId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_blank');
}



function ClientSaveUpdateLawDocumentType(LawDocumentTypeId)
{
    Subject=document.getElementById("txtSubject").value;
    RetValue = Portal.CMS.UpdateLawDocumentType.ServerSideUpdateLawDocumentType(LawDocumentTypeId,Subject).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    window.close();
}


function ShowClientLawDocumentTypeItemUrlForm(LawDocumentTypeId)
{
    Url=Portal.CMS.LawDocumentType.GetShowLawDocumentTypeItemsForm(LawDocumentTypeId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_blank');
}

function ClientShowNewsItemForms(LawDocumentTypeId)
{
    Url=Portal.CMS.LawDocumentType.GetShowNewsItemForm(LawDocumentTypeId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_blank');
}



function JumPageLawDocumentType()
{
    document.getElementById("divProcessing").innerHTML=Portal.CMS.LawDocumentType.GetProcessingText().value;
    setTimeout("RealJumpPageLawDocumentType()",10);
}

function RealJumpPageLawDocumentType()
{
    PageIndex=0;
    if(document.getElementById("divSelectPageLawDocumentType")!=null)
    {   
        PageIndex=document.getElementById("divSelectPageLawDocumentType").selectedIndex;
    }
    Keyword=document.getElementById("txtKeyword").value;
    retValue=Portal.CMS.LawDocumentType.GetHtml(Keyword,PageIndex).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divLawDocumentTypeMain").innerHTML=retValue;
}